package com.zxh.zhenxihuan.mapper;


import com.zxh.zhenxihuan.entity.Goods;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author:geQiang
 * @version:1.0
 * @date:2019/7/26
 * @description:com.zxh.zhenxihuan.mapper
 */
@Mapper
public interface GoodsMapper {
    /**
     * 获得总数
     */
//    @Select(" select count(1) from goods")
    Integer getSum(@Param("productame") String productame, @Param("importanceOptions") Integer importanceOptions);
    /**
     * 查询列表
     */
    List<Goods> getGoods(@Param("start") Integer start,
                         @Param("end") Integer end,
                         @Param("productame") String productame,
                         @Param("importanceOptions") Integer importanceOptions);
    /**
     * 删除用户
     */
    @Delete("delete from goods where id= #{id} ")
    Integer del(Integer id);
    /**
     * 添加
     */
    Long add(Goods goods);

    /**
     * 修改
     */
    @Update("update goods set productame = #{productame} , cid = #{cid} , createDate = #{createDate} ," +
            " inventory = #{inventory} , originalPrice = #{originalPrice} , price = #{price} , " +
            " picpath= #{picpath} ,stateId=#{stateId}  where id= #{id} ")
    Long update(Goods goods);

    /**
     * 查询库存数
     */
    @Select("select inventory from goods ")
    int[] findInventory();

    @Select("select  productame from goods")
    String[] findproName();

}
